#ifndef MATHERR_H
#define MATHERR_H

class MathErr
{
public:
    virtual void what(std::ostream &out) = 0;
};

class BracketsMatchErr : public MathErr
{
public:
    virtual void what(std::ostream &out)
    {
        std::cerr << "Error: Brackets don't match up!";
        out << "Error: Brackets don't match up!";
    }
};

class PointsNumberErr : public MathErr
{
public:
    virtual void what(std::ostream &out)
    {
        std::cerr << "Error: Too much points!";
        out << "Error: Too much points!";
    }
};

class ZeroDivideErr : public MathErr
{
public:
    virtual void what(std::ostream &out)
    {
        std::cerr << "Error: The divisor can't be 0!";
        out << "Error: The divisor can't be 0!";
    }
};

class EmptyExpressionErr : public MathErr
{
public:
    virtual void what(std::ostream &out)
    {
        std::cerr << "Error: The expression can't be empty!";
        out << "Error: The expression can't be empty!";
    }
};

class OperantsMatchErr : public MathErr
{
public:
    virtual void what(std::ostream &out)
    {
        std::cerr << "Error: Numbers and operants don't match!";
        out << "Error: Numbers and operants don't match!";
    }
};
#endif